home *** CD-ROM | disk | FTP | other *** search
/ Languguage OS 2 / Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO / gnu / glibc108.zip / glibc108 / mach / Makefile < prev    next >
Makefile  |  1994-06-06  |  8KB  |  217 lines

  1. # Copyright (C) 1991, 1992, 1993, 1994 Free Software Foundation, Inc.
  2. # This file is part of the GNU C Library.
  3.  
  4. # The GNU C Library is free software; you can redistribute it and/or
  5. # modify it under the terms of the GNU Library General Public License
  6. # as published by the Free Software Foundation; either version 2 of
  7. # the License, or (at your option) any later version.
  8.  
  9. # The GNU C Library is distributed in the hope that it will be useful,
  10. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  12. # Library General Public License for more details.
  13.  
  14. # You should have received a copy of the GNU Library General Public
  15. # License along with the GNU C Library; see the file COPYING.LIB.  If
  16. # not, write to the Free Software Foundation, Inc., 675 Mass Ave,
  17. # Cambridge, MA 02139, USA.
  18.  
  19. subdir := mach
  20.  
  21. all:
  22.  
  23. # Some things below (but before including Rules) use configuration variables.
  24. include ../Makeconfig
  25.  
  26.  
  27. headers = mach_init.h mach.h mach_error.h mach-shortcuts.h \
  28.       $(interface-headers) mach/mach.h mach/mig_support.h mach/error.h \
  29.       $(lock-headers) machine-sp.h
  30. distribute = thread_state.h
  31. lock = spin-solid spin-lock spin-syms mutex-solid
  32. lock-headers = lock-intern.h machine-lock.h spin-lock.h
  33. routines = $(filter-out syscall_%,$(mach-syscalls)) \
  34.        $(addprefix __,$(mach-syscalls)) \
  35.        $(mach-shortcuts) $(addprefix __,$(mach-shortcuts)) \
  36.        mach_init vm_page_size \
  37.        mig_strncpy __msg msg \
  38.        mig-alloc mig-dealloc mig-reply mig_syms \
  39.        msg_destroy msgserver msgserver_t \
  40.        __msg_dest __msgserver \
  41.        mach_error errstring error_compat errsystems \
  42.        devstream bootprivport setup-thread thread-sym $(lock)
  43. # The RPC interfaces go in a separate library.
  44. interface-library := libmachuser.a
  45. user-interfaces := $(addprefix mach/,mach_interface mach_port mach_host    \
  46.                      memory_object_user            \
  47.                      memory_object_default        \
  48.                      exc                \
  49.                 )\
  50.            $(addprefix device/,device device_request)
  51. server-interfaces := device/device_reply mach/exc mach/notify
  52. tests := hello
  53. # It is important that we do not use the wildcard function to expand
  54. # `err_*.sub'.  Leaving the wildcard allows Make-dist to find all matching
  55. # files in all sysdep directories.
  56. distribute += Machrules syscalls.awk shortcut.awk \
  57.           errorlib.h err_*.sub
  58.  
  59.  
  60. # XXX You should copy these files from mk/bootstrap and uncomment these lines.
  61. ifneq (,) # like #if 0 in C
  62. headers += $(addprefix mach/default_pager_types.,h defs) \
  63.        mach/default_pager.defs mach/default_pager_helper.defs
  64. user-interfaces += mach/default_pager
  65. server-interfaces += mach/default_pager_helper
  66. endif # end of commented-out
  67.  
  68. # Clear any environment    value.
  69. generated =
  70.  
  71. # Get the proper definition of `mach-srcdir'.
  72. include ../sysdeps/mach/Makefile
  73.  
  74. # Use and install the Mach header files directly out of the Mach kernel source.
  75.  
  76. # Find the MiG defs files in the kernel source.
  77. vpath %.defs $(mach-srcdir)
  78.  
  79. # Install all .h and .defs files we find in some of the kernel's source
  80. # directories and their subdirectories (in MK82, max one level deep).
  81. mach-src-headers := $(wildcard $(foreach dir,mach device mach_debug \
  82.                          $(config-machine),\
  83.                      $(addprefix $(mach-srcdir)/$(dir)/,\
  84.                              *.defs *.h \
  85.                              */*.defs */*.h)))
  86. # Exclude mach/machine/*.  A symlink will be installed for mach/machine.
  87. # Exclude $(headers) for Mach files we have our own versions of.
  88. mach-headers = $(filter-out mach/machine/% $(headers),\
  89.                 $(mach-src-headers:$(mach-srcdir)/%=%))
  90. # Rename Mach's sys/version.h to mach/version.h.
  91. mach-headers := $(patsubst sys/version.h,mach/version.h,$(mach-headers))
  92.  
  93. # Don't distribute the Mach headers; they are in the Mach distribution.
  94. dont_distribute = $(mach-headers)
  95.  
  96. # DO NOT try to remake these in any way!!!
  97. $(addprefix $(mach-srcdir)/,$(mach-headers)) : ;
  98. install-others += $(addprefix $(includedir)/,$(mach-headers))
  99. $(includedir)/%: $(mach-srcdir)/%; $(do-install)
  100.  
  101. # Make symlinks for machine and mach/machine in the include directory.
  102. install-others += $(includedir)/mach/machine $(includedir)/machine
  103. $(includedir)/mach/machine $(includedir)/machine: $(common-objpfx)config.make
  104.     -rm -f $@
  105.     cd $(@D); ln -s $(config-machine) $(@F)
  106.  
  107. # Install Mach's <sys/version.h> as <mach/version.h>.
  108. install-others += $(includedir)/mach/version.h
  109. $(includedir)/mach/version.h: $(mach-srcdir)/sys/version.h; $(do-install)
  110.  
  111. # Define mach-syscalls and sysno-*.
  112. ifndef inhibit_mach_syscalls
  113. include $(objpfx)mach-syscalls.mk
  114. endif
  115. $(objpfx)mach-syscalls.mk: mach/syscall_sw.h syscalls.awk
  116. # Go kludges!!!
  117.     sed -n -e '/Unix server implement them/,$$d' \
  118.            -e 's/^kernel_trap(\(.*\),\([-0-9]*\),[0-9]*)$$/\1 \2/p' \
  119.     < $< | awk -f $(word 2,$^) > $@-new
  120.     mv $@-new $@
  121. generated += mach-syscalls.mk
  122.  
  123. ifndef mach-syscalls
  124. # We cannot make the deps properly until we know how to make the system
  125. # call functions, and for that we must know what they all are.
  126. no_deps=t
  127. else
  128. $(mach-syscalls:%=$(objpfx)__%.S): $(objpfx)__%.S: $(objpfx)mach-syscalls.mk
  129.     (echo '#include <sysdep.h>'; \
  130.      echo 'SYSCALL_TRAP (__$*, $(sysno-$*))') > $@-new
  131.      mv $@-new $@
  132. $(mach-syscalls:%=$(objpfx)%.c): $(objpfx)%.c: Makefile
  133.     (echo '#include <gnu-stabs.h>'; \
  134.      echo 'symbol_alias (__$*, $*);') > $@-new
  135.     mv $@-new $@
  136. generated += $(mach-syscalls:%=__%.S) \
  137.          $(mach-syscalls:%=%.c)
  138. endif    # mach-syscalls
  139.  
  140. mach-shortcuts := $(patsubst syscall_%,%,$(filter syscall_%,$(mach-syscalls)))
  141.  
  142. ifndef mach-shortcuts
  143. # Forget about mach_interface.defs for this run.  On the next run,
  144. # $(mach-shortcuts) will be set, and that will change how
  145. # mach_interface.defs is processed: it will get the -D flags below.
  146. user-interfaces := $(filter-out mach/mach_interface \
  147.                 mach/mach_port mach/mach_host,\
  148.                 $(user-interfaces))
  149. endif
  150.  
  151. # Make the MiG stubs for $(mach-shortcuts) be CALL_rpc.
  152. migdefines += $(foreach call,$(mach-shortcuts),-D$(call)=$(call)_rpc)
  153. mach/mach_interface.uh mach/mach_port.uh: $(objpfx)mach-syscalls.mk
  154.  
  155. ifdef mach-shortcuts
  156. $(mach-shortcuts:%=$(objpfx)__%.c): $(objpfx)__%.c: shortcut.awk \
  157.                             $(objpfx)RPC_%_rpc.c
  158.     gawk -v call=__$* -v rpc=__$*_rpc -v syscall=__syscall_$* \
  159.          -f $^ > $@-new
  160.     mv $@-new $@
  161.  
  162. # The shortcut calls have had their names changed to CALL_rpc, so
  163. # CALL_rpc.c is being generated with a symbol alias to __CALL_rpc.  
  164. # We also want CALL.c with an alias to __CALL.
  165. $(mach-shortcuts:%=$(objpfx)%.c): $(objpfx)%.c: # Makefile
  166.     (echo '#include <gnu-stabs.h>'; \
  167.      echo 'symbol_alias (__$*, $*);') > $@-new
  168.     mv $@-new $@
  169. generated += $(mach-shortcuts:%=%.c)
  170. endif    # mach-shortcuts
  171.  
  172. # Generate mach-shortcuts.h, which will contain the prototypes for the
  173. # shortcutted kernel RPC functions.
  174. $(objpfx)mach-shortcuts.h: $(objpfx)mach/mach_interface.h \
  175.                $(objpfx)mach/mach_port.h
  176. # The first line gets us one paragraph per line, with @s separating real lines.
  177. # The second line selects paragraphs for the shortcutted functions.
  178. # The third line removes `_rpc' from the names and rerealifies the lines.
  179.     cat $^ | tr \\012 @ | sed s/@@/@%/g | tr % \\012 \
  180.     | grep '^/\* Routine [a-z0-9_]*_rpc \*/' \
  181.     | sed 's/_rpc//g' | tr @ \\012 > $@-new
  182.     mv $@-new $@
  183. generated += mach-shortcuts.h
  184.  
  185. before-compile += $(objpfx)mach-shortcuts.h
  186.  
  187. include Machrules
  188. include ../Rules
  189.  
  190.  
  191. # There is already a mach.h, so mach.defs generates mach_interface.h.
  192. $(objpfx)mach/mach_interface.defs: $(mach-srcdir)/mach/mach.defs
  193.     ln $< $@ || cp $< $@
  194. # There is already a memory_object.h,
  195. # so memory_object.defs generates memory_object_user.h.
  196. $(objpfx)mach/memory_object_user.defs: $(mach-srcdir)/mach/memory_object.defs
  197.     ln $< $@ || cp $< $@
  198.  
  199. ifdef objdir
  200. vpath mach/mach_interface.defs $(objdir)
  201. vpath mach/memory_object_user.defs $(objdir)
  202. endif
  203.  
  204. # Be sure not to make these with implicit rules from foo.defs.
  205. mach.h mach/memory_object.h: ;
  206.  
  207. ifeq (,)
  208. # XXX we have an errsystems.c here because a gcc bug makes the generated
  209. # version lose.
  210. else
  211. generated += errsystems.c
  212. $(objpfx)errsystems.c: errsystems.awk err_*.sub \
  213.                $(wildcard $(addsuffix /err_*.sub,$(+sysdep_dirs)))
  214.     gawk -v subsys='$(filter-out $<,$^)' -f $^ > $@.n
  215.     mv $@.n $@
  216. endif
  217.